Batch mode DXL fails -- Interative OK

the problem is with forward refs

void fwd(string)
caller(string a)
{
fwd(a)
}
void fwd(string a)
{
print a "\n"
}
caller("hi")
the above works when loaded interactively, but fails "forward reference" error in batch mode

What's going on?
SystemAdmin - Tue Nov 16 12:44:36 EST 2010

Re: Batch mode DXL fails -- Interative OK
SystemAdmin - Tue Nov 16 12:59:55 EST 2010

Wrap the whole script in curly brackets
 

{
void fwd(string)
 
caller(string a)
{
fwd(a)
}
 
void fwd(string a)
{
print a "\n"
}
 
caller("hi")
}

Re: Batch mode DXL fails -- Interative OK
SystemAdmin - Wed Nov 17 03:21:38 EST 2010

SystemAdmin - Tue Nov 16 12:59:55 EST 2010

Wrap the whole script in curly brackets
 

{
void fwd(string)
 
caller(string a)
{
fwd(a)
}
 
void fwd(string a)
{
print a "\n"
}
 
caller("hi")
}

Thanks, but wrapping the script seems cause the script
to devolve to a no-op. (no output, nada) I added writing
to a stream instead of a print--no file created, nothing.

As an aside--why SHOULD the above even work? I'm
curious (as well as suicidally frustrated.)

I'm running V8.2 just in case this matters.

Re: Batch mode DXL fails -- Interative OK
Peter_Albert - Wed Nov 17 03:43:07 EST 2010

SystemAdmin - Wed Nov 17 03:21:38 EST 2010
Thanks, but wrapping the script seems cause the script
to devolve to a no-op. (no output, nada) I added writing
to a stream instead of a print--no file created, nothing.

As an aside--why SHOULD the above even work? I'm
curious (as well as suicidally frustrated.)

I'm running V8.2 just in case this matters.

I am pretty sure it was just a mistake when you put your example into the original post (as otherwise you would have got error messages) but the "void" in front of "caller" is missing in the original post.

The below code works as expected in batch mode (tested on DOORS 8.3):

{
  void fwd(string)
  
  void caller(string a)
  {
    fwd(a)
  }
  
  void fwd(string a)
  {
    print a "\n"
  }
  
  caller("hi")
}

 


when put into C:\TEMP\batch.dxl and called à la

 

start "DOORS" "C:\Program Files\Telelogic\DOORS_8.3\bin\doors.exe"  -u abc-P xyz -b C:\TEMP\batch.dxl

 


Regards,

Peter

 

Re: Batch mode DXL fails -- Interative OK
Mathias Mamsch - Wed Nov 17 03:44:09 EST 2010

SystemAdmin - Wed Nov 17 03:21:38 EST 2010
Thanks, but wrapping the script seems cause the script
to devolve to a no-op. (no output, nada) I added writing
to a stream instead of a print--no file created, nothing.

As an aside--why SHOULD the above even work? I'm
curious (as well as suicidally frustrated.)

I'm running V8.2 just in case this matters.

The DOORS parser seems to not recognize forward declarations properly when they are on the top level. When you run any script from the GUI, DOORS will automatically wrap your script with the following header:
 

{ Object obj = obj__
  dxlAttrName = ... 
  // your script
}

 


In this case forward declarations seem to work fine (since they already have braces around them). However when running in batch mode this wrapping of DXL code will not be made. In this case the forward declarations seem to fail. Normally you should have no impact on your script by wrapping it in curly braces. I run DOORS 8.2 myself and I tried your example, without curly braces I get the compile error "forward declaration not resolved". With curly braces I get a normal output. So maybe there is another reason for your script not yielding any output in batch mode?

Regards, Mathias

 

 


Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS

 

Re: Batch mode DXL fails -- Interative OK
SystemAdmin - Wed Nov 17 03:54:19 EST 2010

SystemAdmin - Wed Nov 17 03:21:38 EST 2010
Thanks, but wrapping the script seems cause the script
to devolve to a no-op. (no output, nada) I added writing
to a stream instead of a print--no file created, nothing.

As an aside--why SHOULD the above even work? I'm
curious (as well as suicidally frustrated.)

I'm running V8.2 just in case this matters.

This works! (It seems to need something to execute
within the outer scope.)
print "Can you spell HACK\n"

{
void fwd(string)

caller(string a)
{
fwd(a)
}

void fwd(string a)
{
print a "\n"
}

caller("hi")
}